package com.zretc.file.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Data
@ConfigurationProperties(prefix = "minio")
public class MinioConfig {

    private String url;
    private String accessKey;
    private String secretKey;
    private String[] bucketName;

    // 配置minio客户端
    @Bean
    public MinioClient getMinioClient(){
        return MinioClient.builder() // 构建
                .endpoint(url) // 连接
                .credentials(accessKey, secretKey) // 校验
                .build();
    }

}
